//
//  UIImageView+UIimageViewMode.m
//  Topit
//
//  Created by dllo on 15/12/16.
//  Copyright © 2015年 YXY. All rights reserved.
//

#import "UIImageView+UIimageViewMode.h"

@implementation UIImageView (UIimageViewMode)
- (void)nightMode {
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString *mode = [user objectForKey:@"NightMode"];
    UIView *view = [[UIView alloc] initWithFrame:self.bounds];
    view.backgroundColor = [UIColor blackColor];
    
    if ([mode isEqualToString:@"Night"]) {
        if (self.subviews.count == 0) {
            [self addSubview:view];
        }
        view.alpha = 0.3;
        
    }else {
        [self removeAllSubviews];
    }

}

@end
